import React, { Component } from 'react'
import { Form, Input } from 'antd'
const Item = Form.Item

export default class Editfrom extends Component {

  render() {
    const { parentName, editfrom, prvname } = this.props
    return (
      <Form preserve={false}
        initialValues={{ parentName: prvname }}
        ref={editfrom}><span>所属分类：</span>
        <Item>
          <Input value={parentName === '' ? '一级分类' : parentName} disabled />
        </Item>
        <span>分类名称：</span>
        <Item name='parentName' rules={[{ required: true, message: '名称必须填写！' }, {
          validator: (_, value) => {return  value !== prvname ? Promise.resolve() : Promise.reject('和原名称相同！')},
        }]}>
          <Input autoComplete={'off'} placeholder='请输入分类名称' onPressEnter={this.props.updatedata} />
        </Item>
      </Form>
    )
  }
}





